/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package control;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import model.ProfissionalDAO;

/**
 *
 * @author Eduarda
 */
public class TrataExcluirProfissional extends Comando{

    @Override
    public void executar(HttpServletRequest request, HttpServletResponse response) throws ClassNotFoundException, SQLException, IOException, ServletException {
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
        try {
            response.setContentType("text/html");
            
            String Compromisso = request.getParameter("idExcluir");
            int idCom = Integer.parseInt(Compromisso);
            
            new ProfissionalDAO().excluir(idCom);
            
            response.sendRedirect("profissionalExcluido.jsp");  
        } catch (SQLException ex) {
            throw new ServletException(ex);
        }
    }
    
}
